﻿using System.Windows.Forms.DataVisualization.Charting;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace uTILLIty.ChartBuilder.Core.Configuration
{
	[XmlRoot(Namespace = "http://dev.buwog.at/schemas/ChartBuilder/v1")]
	[XmlType(AnonymousType = true),]
	public class ChartConfiguration
	{
		public ChartConfiguration()
		{
			Format = ChartImageFormat.Png;
			Width = 600;
			Height = 300;
			DataSource = new DataSourceConfiguration();
			Series = new SeriesConfiguration[0];
		}

		[XmlAttribute("format")]
		public ChartImageFormat Format { get; set; }

		[XmlElement(IsNullable = true)]
		public DataSourceConfiguration DataSource { get; set; }

		[XmlArray("Series", IsNullable = false), XmlArrayItem("Series")]
		public SeriesConfiguration[] Series { get; set; }

		[XmlAttribute("width")]
		public int Width { get; set; }

		[XmlAttribute("height")]
		public int Height { get; set; }

		[XmlElement(Form = XmlSchemaForm.Unqualified)]
		public XmlElement Design { get; set; }
	}
}